package cn.lili.controller.auth;

import cn.lili.common.vo.ResultMessage;
import cn.lili.modules.auth.service.OperationQrCodeLoginService;
import io.swagger.annotations.Api;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@Api(tags = "运营中心-扫码登录")
@RequestMapping("/auth/qrcodelogin")
@RequiredArgsConstructor
public class OperationCenterQrCodeLoginController {

    private final OperationQrCodeLoginService operationQrCodeLoginService;

    /**
     * 运营中心扫码登陆-创建二维码
     *
     * @param scene 应用场景
     * @return 二维码图片
     */
    @RequestMapping("/createQrCode")
    public ResultMessage<Object> createQrCode(String scene, String userId) {
        return operationQrCodeLoginService.createQrCode(scene, userId);
    }


    /**
     * 创建二维码
     *
     * @param code 二维码id
     * @return 二维码图片
     */
    @RequestMapping("/checkCode")
    public ResultMessage<Object> checkCode(String code) {
        return operationQrCodeLoginService.checkCode(code);
    }
}
